// 新增物料命令
export class AddMultipleWidgetCommand {
  constructor(multipleWidget, widgetList, widgetMap) {
    this.multipleWidget = multipleWidget
    this.widgetList = widgetList
    this.widgetMap = widgetMap
  }
  execute() {
    this.widgetList.push(...this.multipleWidget)
    this.multipleWidget.forEach((item) => {
      this.widgetMap.set(item.options.propName, item)
    })
  }
  undo() {
    this.widgetList.splice(
      this.widgetList.length - this.multipleWidget.length,
      this.multipleWidget.length
    )
    this.multipleWidget.forEach((item) => {
      this.widgetMap.delete(item.options.propName)
    })
  }
}
